Javascript Program for Prime Numbers
Prime numbers...
read more
Javascript Program for Count Primes in Ranges
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of queries for different ranges.Examples:...
read more
Php Program to Count Primes in Ranges
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of queries for different ranges.Examples:...
read more
Check whether a number is Emirpimes or not
Given a number ‘n’, check whether it is an emirpimes or not....
read more
Ordered Prime Signature
Given a number n, find the ordered prime signatures and using this find the number of divisor of given n. Any positive integer, ‘n’ can be expressed in the form of its prime factors. If ‘n’ has p1, p2, … etc. as its prime factors, then n can be expressed as : Now, arrange the obtained exponents of the prime factors of ‘n’ in non-decreasing order. The arrangement thus obtained is called the ordered prime signature of the positive integer ‘n’.Example:...
read more
XOR of Prime Frequencies of Characters in a String
Given a string containing only lowercase english alphabets. The task is to find the bitwise XOR of all the prime frequencies of the characters in the string. If no prime frequency is present, then print -1....
read more
Sum of numbers in a range [L, R] whose count of divisors is prime
Given Q queries where each query consists of an integer range [L, R], the task is to find the sum of the integers from the given range whose count of divisors is prime.Examples:...
read more
Find the sum of prime numbers in the Kth array
Given K arrays where the first array contains the first prime number, the second array contains the next 2 primes and the third array contains the next 3 primes and so on. The task is to find the sum of primes in the Kth array.Examples:...
read more
Minimize swaps required to make all prime-indexed elements as prime
Given an array arr[] of size N. The task is to find the minimum number of swaps required to re-arrange the array such that all prime-indexed elements are prime, If the task can’t be achieved, print “-1“...
read more
Sum of array elements which are prime factors of a given number
Given an array arr[] of size N and a positive integer K, the task is to find the sum of all array elements which are prime factors of K....
read more
Sum of prime numbers without odd prime digits
Given an integer N. The task is to find the sum of the first N prime numbers which don’t contain any odd primes as their digit.Some of such prime numbers are 2, 11, 19, 29, 41 …… Examples:...
read more
Vantieghems Theorem for Primality Test
Vantieghems Theorem is a necessary and sufficient condition for a number to be prime. It states that for a natural number n to be prime, the product of where , is congruent to . In other words, a number n is prime if and only if....
read more